package com.ruoyi.system.controller;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.service.IIndexService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

/**
 * 首页Controller
 *
 * @author silencezheng
 * @date 2022-10-20
 */
@RestController
@RequestMapping("/index")
public class IndexController extends BaseController
{
    @Autowired
    private IIndexService indexService;

    /**
     * 获取首页信息数统计
     *
     * @return
     */
    @GetMapping("/getCount")
    public AjaxResult getCount() {
        return AjaxResult.success(indexService.getCount());
    }
    /**
     * 获取每个月的航班数统计
     */
    @GetMapping("/getFlightMonthCount")
    public AjaxResult getFlightMonthCount() {
        List<Map<String, Object>> countList = indexService.getFlightMonthCount();
        return AjaxResult.success(countList);
    }
    /**
     * 获取每个月的收入统计
     */
    @GetMapping("/getMoneyCount")
    public AjaxResult getMoneyCount() {
        List<Map<String, Object>> countList = indexService.getMoneyCount();
        return AjaxResult.success(countList);
    }
    /**
     * 获取不同状态的订单统计
     */
    @GetMapping("/getTicketState")
    public AjaxResult getTicketState() {
        List<Map<String, Object>> countList = indexService.getTicketState();
        return AjaxResult.success(countList);
    }
}
